package com.leetcode.题库;

import com.leetcode.common.model.TreeNode;

/**
 * @author 覃国强
 * @date 2022-05-01 10:59
 */
public class 题库_0700_二叉搜索树中的搜索 {



  static
  class Solution {
    public TreeNode searchBST(TreeNode root, int val) {
      if (root == null || root.val == val) {
        return root;
      }
      if (val < root.val) {
        return searchBST(root.left, val);
      } else {
        return searchBST(root.right, val);
      }
    }
  }

}
